<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page language="java" import="java.io.*" %>
<%@page import="org.apache.commons.fileupload.FileItem"%>
<%@page import="org.apache.commons.fileupload.disk.DiskFileItemFactory"%>
<%@page import="org.apache.commons.fileupload.servlet.ServletFileUpload"%>
<%@page import="java.text.SimpleDateFormat"%>

<%
try{
Date da=new Date();
SimpleDateFormat si=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar ca=Calendar.getInstance();
long nowdate=ca.getTime().getTime();//获取毫秒型日期
System.out.println("mt:"+nowdate);
System.out.println("mt:1:"+si.format(nowdate));
  String ntkopath=null;
  FileItem it=null;
  System.out.println("进入");
  //获取上文件的信息
  DiskFileItemFactory dis=new DiskFileItemFactory();

  ServletFileUpload up=new ServletFileUpload(dis);

  //获取响应里面的信息
  List list=up.parseRequest(request);

  Object[] ob=list.toArray();

  //循环里面的信息
  for(int i=0;i<ob.length;i++){
    it=(FileItem)ob[i];
 
   //获取文件的名字和路径
   String ntko=it.getName();
   
 System.out.println(ntko);
   //获取文件名
  String ntkoname= ntko.substring(ntko.lastIndexOf("\\")+1);
System.out.println("ntkoname:"+ntkoname);
  //获取服务器路径
  String route=application.getRealPath("/");

  ntkopath=route+"ntkooffice\\"+ntkoname;

  }
    //把文档存入磁盘中
  File file=new File(ntkopath);

   it.write(file);
   response.getWriter().append("ntko");
   Calendar ca1=Calendar.getInstance();
long nowdate1=ca1.getTime().getTime();//获取毫秒型日期
  System.out.println("mt12312:"+nowdate1); 
  System.out.println("差值:"+((nowdate1-nowdate)/(1000 * 60 * 60 * 24))); 
 }catch(Exception e){
 System.out.println(e);
 }
 %>
